package com.atguigu.gmall.service.impl;

import com.atguigu.gmall.bean.UserAddress;
import com.atguigu.gmall.service.UserService;
import org.springframework.util.StringUtils;

import java.util.List;
/*本地存根代码*/
public class UserServiceStub implements UserService {
    private final UserService userService;
    /**
     * 有参构造对象，传入的是userService远程的代理对象
     */
    public UserServiceStub(UserService userService) {
        this.userService = userService;
    }

    @Override
    public List<UserAddress> getUserAddressList(String userId) {
        System.out.println("本地存根：UserServiceStub");
        if(!StringUtils.isEmpty(userId)){
            //如果传入的userId不是空串时再进行远程调用
            return userService.getUserAddressList(userId);
        }
        return null;
    }
}
